#!/usr/bin/env python
# -*- coding:utf-8 -*-

from kafka import SimpleProducer, KafkaClient
kafka = KafkaClient('192.168.31.101:9092')
from scpy.logger import get_logger
producer = SimpleProducer(kafka)
import multiprocessing
import sys
pool = multiprocessing.Pool(10)

logger = get_logger(__file__)
topic = 'topic-test'

def send_messagee(num):
    start = num*10000000
    end = start+10000000
    index = 0
    logger.info('start')
    for i in xrange(start,end):
        index+=1
        if index%10000==0:
            logger.info(index)
        producer.send_messages(topic, b'some message%s'%(i,))

if __name__ == '__main__':
    num = int(sys.argv[1])
    send_messagee(num)
